#ifndef K_REPRESENTATIVE
#define K_REPRESENTATIVE

#include "Client.h"

#include <vector>
using std::vector;
#include <map>
using std::map;
#include <set>
using std::set;

typedef vector<Client> Cluster;
typedef map<double, double> qValue;
typedef vector<qValue> ClusterRepresentative;

class K_Representative
{
	int _k;
	bool _hybrid;
public:
	K_Representative(int k, bool hybrid=false);
	vector<Cluster> compute(const vector<Client>& data) const;
	ClusterRepresentative ComputeQ(const Cluster&  aCluster) const;
private:
	vector<Cluster> createRandomCluster(const vector<Client>& data) const;
	double dissimilarity(const Client& x,const ClusterRepresentative& q) const;
	double hybridDissimilarity(const Client& x, const ClusterRepresentative& q, const map<int, double>& clusterNumericValuesAverage, const set<int>& numericAttributeIndexes, const vector<double>& min, const vector<double>& max) const;
	set<int> getNumericAttributeIndexes(vector<ClusterRepresentative>& QList)const;
	vector<map<int, double>> getClusterNumericValuesAverage(const vector<Cluster>& clusters ,const set<int>& numericAttributeIndexes)const;
	vector<double> getMaxVector(const vector<Client>& data) const;
	vector<double> getMinVector(const vector<Client>& data) const;
	double minMaxNormalization(const double& value, const double& min, const double& max) const;
};

#endif //K_REPRESENTATIVE
